/**
 * 
 */
package org.youisoft.summer.evaluator.function.service;

import org.youisoft.summer.evaluator.InvokeException;
import org.youisoft.summer.evaluator.context.CalContext;
import org.youisoft.summer.evaluator.function.AbstractFunction;
import org.youisoft.summer.evaluator.operator.Operator;
import org.youisoft.summer.evaluator.operator.base.ListOperator;
import org.youisoft.summer.evaluator.operator.base.MessageOperator;

/**
 * @author zijiang.jl
 *
 */
public class InBoundFunction extends AbstractFunction{

	@Override
	protected boolean checkOperator(int index,Operator<?> operator){
		return operator instanceof MessageOperator;
	}

	@Override
	public <C, R, P> Operator<?> doParenthesisInvoke(CalContext<C, R, P> context,
			Operator<?>... operator) throws InvokeException {
		System.out.println("in InBoundFunction");
		if(operator.length==1) return operator[0];
		ListOperator<Operator<?>> lo=new ListOperator<Operator<?>>();
		for(int i=0;i<operator.length;i++){
			lo.addOperator(operator[i]);
		}
		return lo;
	}
	


	
}
